<?php
namespace common\models;

use Yii;

/**
 * This is the model class for table "banner".
 *
 * @property integer $id
 * @property string $logo
 * @property string $url
 * @property integer $type
 * @property integer $order
 */
class Banner extends \yii\db\ActiveRecord
{

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'banner';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [
                [
                    'url',
                    'type',
                    'order'
                ],
                'required'
            ],
            [
                [
                    'type',
                    'order'
                ],
                'integer'
            ],
            [
                [
                    'logo'
                ],
                'file',
                'extensions' => 'jpg,gif,png'
            ],
            [
                [
                    'url'
                ],
                'string',
                'max' => 30
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'logo' => '广告图',
            'url' => '链接',
            'type' => '类型',
            'order' => '顺序'
        ];
    }
}
